package com.printhelper.model;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.LocalDateTime;
import java.util.Objects;

@Document(collection = "conversions")
public class Conversion {
    
    @Id
    private String id;
    
    private String userId;
    
    private String originalFileName;
    
    private String pdfFilePath;
    
    private String pptFilePath;
    
    private int pageCount;
    
    private String status; // PENDING, PROCESSING, COMPLETED, FAILED
    
    private String errorMessage;
    
    private LocalDateTime createdAt;
    
    private LocalDateTime completedAt;
    
    private long fileSize;
    
    public Conversion() {
    }
    
    public Conversion(String id, String userId, String originalFileName, String pdfFilePath, 
                     String pptFilePath, int pageCount, String status, String errorMessage, 
                     LocalDateTime createdAt, LocalDateTime completedAt, long fileSize) {
        this.id = id;
        this.userId = userId;
        this.originalFileName = originalFileName;
        this.pdfFilePath = pdfFilePath;
        this.pptFilePath = pptFilePath;
        this.pageCount = pageCount;
        this.status = status;
        this.errorMessage = errorMessage;
        this.createdAt = createdAt;
        this.completedAt = completedAt;
        this.fileSize = fileSize;
    }
    
    // Getters and Setters
    public String getId() {
        return id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    
    public String getUserId() {
        return userId;
    }
    
    public void setUserId(String userId) {
        this.userId = userId;
    }
    
    public String getOriginalFileName() {
        return originalFileName;
    }
    
    public void setOriginalFileName(String originalFileName) {
        this.originalFileName = originalFileName;
    }
    
    public String getPdfFilePath() {
        return pdfFilePath;
    }
    
    public void setPdfFilePath(String pdfFilePath) {
        this.pdfFilePath = pdfFilePath;
    }
    
    public String getPptFilePath() {
        return pptFilePath;
    }
    
    public void setPptFilePath(String pptFilePath) {
        this.pptFilePath = pptFilePath;
    }
    
    public int getPageCount() {
        return pageCount;
    }
    
    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public String getErrorMessage() {
        return errorMessage;
    }
    
    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
    
    public LocalDateTime getCreatedAt() {
        return createdAt;
    }
    
    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }
    
    public LocalDateTime getCompletedAt() {
        return completedAt;
    }
    
    public void setCompletedAt(LocalDateTime completedAt) {
        this.completedAt = completedAt;
    }
    
    public long getFileSize() {
        return fileSize;
    }
    
    public void setFileSize(long fileSize) {
        this.fileSize = fileSize;
    }
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Conversion that = (Conversion) o;
        return pageCount == that.pageCount && 
               fileSize == that.fileSize && 
               Objects.equals(id, that.id) && 
               Objects.equals(userId, that.userId) && 
               Objects.equals(originalFileName, that.originalFileName) && 
               Objects.equals(pdfFilePath, that.pdfFilePath) && 
               Objects.equals(pptFilePath, that.pptFilePath) && 
               Objects.equals(status, that.status) && 
               Objects.equals(errorMessage, that.errorMessage) && 
               Objects.equals(createdAt, that.createdAt) && 
               Objects.equals(completedAt, that.completedAt);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(id, userId, originalFileName, pdfFilePath, pptFilePath, 
                           pageCount, status, errorMessage, createdAt, completedAt, fileSize);
    }
    
    @Override
    public String toString() {
        return "Conversion{" +
                "id='" + id + '\'' +
                ", userId='" + userId + '\'' +
                ", originalFileName='" + originalFileName + '\'' +
                ", pdfFilePath='" + pdfFilePath + '\'' +
                ", pptFilePath='" + pptFilePath + '\'' +
                ", pageCount=" + pageCount +
                ", status='" + status + '\'' +
                ", errorMessage='" + errorMessage + '\'' +
                ", createdAt=" + createdAt +
                ", completedAt=" + completedAt +
                ", fileSize=" + fileSize +
                '}';
    }
} 